/*
 * Created on Feb 19, 2004
 *
 * Author: Sandeep Prakash
 * Project: Sucxentv2 (using leaf nodes only)
 */
package dbsucxentW.storageEdgeW.loadersW;

import dbsucxentW.storageEdgeW.entitiesW.LeafNode;
import dbsucxentW.storageEdgeW.entitiesW.LeafNodeCollection;

/**
 * @author Administrator
 *
 * 
 */
public abstract class Store {
	
	//
	//Collection to store.
	//
	protected LeafNodeCollection _collection;
	//k 2070525 what's this used for? protected int _first;
	protected String _file; 				//File to be shredded; (k 20070525)
	protected int _docId = -1;				//klarinda 20070525
	
	public Store() {
		super();
	}
	
	
	public void store( LeafNodeCollection collection ) throws Exception{

		_collection = collection;
		
		//k20070525 what's _first used for? if (_first == 0){
			init();
		//	_first++;
		//}
		
		//extend BS
		
		/* klarinda 20060905 use bulk loading 
		while( _collection.next() ){
			add( _collection.get() );
		}
		*/
		commit();
		generateStatistics();	//klarinda 20070525
	}
	
	//
	//Initialize
	public abstract void init() throws Exception;
	
	//
	//Store
	//klarinda 20060905 use bulk loading 
	//public abstract void add( LeafNode node ) throws Exception;
	
	public abstract void storePath(int pathId, String path);
	//
	//Commit changes.
	public abstract void commit() throws Exception;
	
	//klarinda 20070525 To generate Statistics (PathCount, TotalPathCount, ValueSelectivity)
	public abstract void generateStatistics() throws Exception;
	
	//
	//Identify document. generate Id.
	public abstract void generateDocId() throws Exception;
	
	//klarinda 20070525
	public int getDocId(){
		return _docId;
	}
	
	public abstract void complete() throws Exception;
	
}
